<template>
  <div>
    <van-nav-bar
      fixed
      placeholder
      safe-area-inset-top
      title="新闻详情"
      left-arrow
      @click-left="back"
    />
    <div class="contentbox">
      <div class="title">{{ newsinfo.title }}</div>
      <div class="show">
        <div>
          <van-icon class="tip" name="underway-o" /><span
            style="margin-right: 15px"
          >{{ newsinfo.createTime }}</span>
        </div>
        <div>
          <span class="tip">来源:</span><span>{{ newsinfo.source }}</span>
        </div>
      </div>
      <div class="content" v-html="newsinfo.content" />
    </div>
  </div>
</template>

<script>
import { getNewsdetail } from '../../apis/buy.js'
export default {
  data() {
    return {
      id: '',
      newsinfo: {}
    }
  },
  created() {
    this.id = this.$route.query.id
    getNewsdetail({ newsId: this.id }).then((res) => {
      console.log(res)
      this.newsinfo = res.result
    })
  },
  methods: {
    back() {
      this.$router.go(-1)
    }
  }
}
</script>

<style lang="less" scoped>
.title {
  font-size: 18px;
  color: #333;
  font-weight: bold;
  margin: 10px 15px;
}
.show {
  display: flex;
  justify-content: space-between;
  margin: 10px 15px;
  > div {
    display: flex;
    align-items: center;
    color: #666;
    font-size: 13px;
    .tip {
      margin-right: 3px;
    }
  }
}
/deep/.content {
  box-sizing: border-box;
  margin: 10px 15px;
  img {
    width: 100%;
  }
}
</style>
